﻿layui.use(['form', 'layer', 'jquery'], function () {
    var form = layui.form;
    var layer = layui.layer;
    var $ = layui.jquery;
    window.UserAdd = function UserAdd() {
        var model = JSON.stringify({
            // offic_id:"1859111395346485248",
            name: $('#name').val(),
            role_type: $('#role_type').val(),
            data_scope: $('input[name="data_scope"]:checked').val(),
            useable: $('input[name="useable"]:checked').val(),
            role_level: $('input[name="role_level"]:checked').val()
        })
        console.log("角色添加数据：", model)
        var token = localStorage.getItem("token")
        $.ajax({
            url: '../User/UserRoleDo',
            type: 'post',
            data: { model: model, token: token },
            success: function (res) {
                console.log(res)
                // debugger;
                var ressult = JSON.parse(res)
                if (ressult.code == 200) {
                    alert(ressult.message)
                }
                else {
                    alert(ressult.message)
                }
            }
        })
    }
})